#ifndef QFILEINFESORTERFACTORY_H
#define QFILEINFESORTERFACTORY_H

#include <qpair.h>
#include <qalgorithms.h>
#include <qfileinfo.h>
#include <qvariant.h>
#include <qshareddata.h>

class MyFileInfoData : public QSharedData{
public:
    MyFileInfoData(const QFileInfo& f, int code, const QString& p = QString())
        : QSharedData(), info(f), m_code(code), param(p) {
    }
    MyFileInfoData(const MyFileInfoData& orig)
        : QSharedData(orig), info(orig.info), m_code(orig.m_code), param(orig.param), v(orig.v) {
    }
    virtual ~MyFileInfoData(){ }
    QFileInfo info;
    int m_code;
    QString param;
    mutable QVariant v;
};


class MyFileInfo{
public:
    MyFileInfo(const QFileInfo& f, int code, const QString& p = QString())
        : d(new MyFileInfoData(f, code, p)) {
    }
    MyFileInfo(const MyFileInfo& orig)
        : d(orig.d) {
    }
    virtual ~MyFileInfo(){ }

    bool operator< (const MyFileInfo &t2) const;

    QExplicitlySharedDataPointer<MyFileInfoData> d;

};

class QFileInfeSorterFactory
{
public:
    static QStringList getSorterDescriptions();
    static qLess<MyFileInfo>* getSorterByIdx(const int&, const QString& param = QString());
private:
    QFileInfeSorterFactory();
};

#endif // QFILEINFESORTERFACTORY_H
